package com.xms.webresource.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.xms.datacore.service.FinderService;
import com.xms.webresource.entity.WebResource;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.UUID;

/**
 * <p>
 * WebResourceFinderService
 * </p>
 *
 * @author migo
 * @since 2021/9/8
 */
@CacheConfig(cacheNames = "webresource", keyGenerator = "CacheKeyGenerator")
@Service
public class WebResourceFinderService extends FinderService<WebResource> implements IWebResourceFinderService {

    @Cacheable(condition="#id != null")
    @Override
    public WebResource getById(UUID id) {
        return super.getById(id);
    }

    @Cacheable(condition="#idList != null && #idList.size() > 0")
    @Override
    public List<WebResource> getByIds(Collection<UUID> idList) {
        return super.listByIds(idList);
    }

    //@Cacheable()
    @Override
    public WebResource getOne(Wrapper<WebResource> queryWrapper) {
        return super.getOne(queryWrapper);
    }

    @Cacheable()
    @Override
    public int count() {
        return super.count();
    }

    //@Cacheable()
    @Override
    public int count(Wrapper<WebResource> queryWrapper) {
        return super.count(queryWrapper);
    }

    //@Cacheable()
    @Override
    public List<WebResource> list(Wrapper<WebResource> queryWrapper) {
        return super.list(queryWrapper);
    }

    @Cacheable()
    @Override
    public List<WebResource> all() {
        return super.list();
    }
}
